Intro

I want to show how many years the length of athlete’s careers last, and how it has been different between Male and Female athletes over the years.

Fish plot 1

plot1 <- ggplot(athletes_total_events, aes(y=events, color=sex)) +
  geom_segment(aes(y=0, 
               yend=events,
               x=year.first, 
               xend=year.last),
               linewidth=0.5)

plot1

Fish plot 2

plot2 <- ggplot(events_new_athletes, aes(y=events, color=sex)) +
  geom_segment(aes(y=0,
                   yend=events,
                   x=year.first,
                   xend=year.last),
               linewidth=1)
plot2

Bar chart

plot3 <- ggplot(events_new_athletes) +
  geom_bar(aes(x=year.first, weight=events, color=sex, fill=sex), position = position_dodge())

ggplotly(plot3)